#ifndef _SCENES_H
#define _SCENES_H

#include "Plane.h"
#include "PinholeCamera.h"
#include "Camera.h"

using namespace Pandora;

CScene ThreeSpheresScene()
{
	CScene Scene = CScene(640, 480, new CPinholeCamera(640, 480));

	Scene.GetCamera()->SetPosition(320.0f, 220.0f, -380.0f);
	Scene.GetCamera()->SetDirection(0.0f, 0.0f, 1.0f);

	Scene.materialContainer.resize(3);
	Scene.primitiveContainer.resize(3);
	Scene.lightContainer.resize(2);

	//Materials
	Scene.materialContainer[0] = new CMaterial();
	Scene.materialContainer[0]->SetColor(1.0f, 1.0f, 0.0f);
	Scene.materialContainer[0]->SetReflection(0.5f);
	Scene.materialContainer[0]->SetSpecular(1.0f, 1.0f, 1.0f);
	Scene.materialContainer[0]->SetSpecularPower(60.0f);

	Scene.materialContainer[1] = new CMaterial();
	Scene.materialContainer[1]->SetColor(0.0f, 1.0f, 1.0f);
	Scene.materialContainer[1]->SetReflection(0.5f);
	Scene.materialContainer[1]->SetSpecular(1.0f, 1.0f, 1.0f);
	Scene.materialContainer[1]->SetSpecularPower(60.0f);

	Scene.materialContainer[2] = new CMaterial();
	Scene.materialContainer[2]->SetColor(1.0f, 0.0f, 1.0f);
	Scene.materialContainer[2]->SetReflection(0.5f);
	Scene.materialContainer[2]->SetSpecular(1.0f, 1.0f, 1.0f);
	Scene.materialContainer[2]->SetSpecularPower(60.0f);

	//Primitives
	Scene.primitiveContainer[0] = new CSphere(233.0f, 290.0f, 0.0f, 100.0f);
	Scene.primitiveContainer[0]->SetMaterial(Scene.materialContainer[0]);

	Scene.primitiveContainer[1] = new CSphere(407.0f, 290.0f, 0.0f, 100.0f);
	Scene.primitiveContainer[1]->SetMaterial(Scene.materialContainer[1]);

	Scene.primitiveContainer[2] = new CSphere(320.0f, 140.0f, 0.0f, 100.0f);
	Scene.primitiveContainer[2]->SetMaterial(Scene.materialContainer[2]);

	//Lights
	Scene.lightContainer[0] = new CLight();
	Scene.lightContainer[0]->SetPosition(0.0f, 240.0f, -100.0f);
	Scene.lightContainer[0]->SetColor(1.0f, 1.0f, 1.0f);

	Scene.lightContainer[1] = new CLight();
	Scene.lightContainer[1]->SetPosition(640.0f, 240.0f, -10000.0f);
	Scene.lightContainer[1]->SetColor(0.6f, 0.7f, 1.0f);

	return Scene;
}

CScene Refraction()
{
	CScene Scene = CScene(640, 480, new CPinholeCamera(640, 480));

	Scene.GetCamera()->SetPosition(700.0f, 425.0f, -200.0f);
	Scene.GetCamera()->SetDirection(0.0f, 0.0f, 1.0f);

	Scene.SetEnviromentRefraction(1.0f);

	Scene.materialContainer.resize(3);
	Scene.primitiveContainer.resize(2);
	Scene.lightContainer.resize(2);

	//Materials
	Scene.materialContainer[0] = new CMaterial();
	Scene.materialContainer[0]->SetColor(1.0f, 1.0f, 0.0f);
	Scene.materialContainer[0]->SetReflection(0.5f);
	Scene.materialContainer[0]->SetSpecular(1.0f, 1.0f, 1.0f);
	Scene.materialContainer[0]->SetSpecularPower(60.0f);
	Scene.materialContainer[0]->SetRefraction(0.0f);

	Scene.materialContainer[1] = new CMaterial();
	Scene.materialContainer[1]->SetColor(0.0f, 1.0f, 1.0f);
	Scene.materialContainer[1]->SetReflection(0.0f);
	Scene.materialContainer[1]->SetSpecular(1.0f, 1.0f, 1.0f);
	Scene.materialContainer[1]->SetSpecularPower(200.0f);
	Scene.materialContainer[1]->SetRefraction(0.0f);

	Scene.materialContainer[2] = new CMaterial();
	Scene.materialContainer[2]->SetColor(0.0f, 0.0f, 0.0f);
	Scene.materialContainer[2]->SetReflection(0.5f);
	Scene.materialContainer[2]->SetSpecular(1.0f, 1.0f, 0.0f);
	Scene.materialContainer[2]->SetSpecularPower(200.0f);
	Scene.materialContainer[2]->SetRefraction(1.5f);

	//Primitives

	Scene.primitiveContainer[0] = new CSphere(500.0f, 425.0f, 600.0f, 250.0f);
	Scene.primitiveContainer[0]->SetMaterial(Scene.materialContainer[2]);

	Scene.primitiveContainer[1] = new CPlane(0.0f, 1.0f, .0f, 400.0f);
	Scene.primitiveContainer[1]->SetMaterial(Scene.materialContainer[1]);

	for(int i = 1; i <= 10; i++)
		for(int j = 1; j <= 10; j++)
		{
			Scene.primitiveContainer.push_back(new CSphere(i*100.0f, j*100.0f, 800.0f, 50.0f));
			Scene.primitiveContainer[Scene.primitiveContainer.size() - 1]->SetMaterial(Scene.materialContainer[0]);
		}

	//Lights
	Scene.lightContainer[0] = new CLight();
	Scene.lightContainer[0]->SetPosition(0.0f, 240.0f, -100.0f);
	Scene.lightContainer[0]->SetColor(1.0f, 1.0f, 1.0f);

	Scene.lightContainer[1] = new CLight();
	Scene.lightContainer[1]->SetPosition(640.0f, 240.0f, -10000.0f);
	Scene.lightContainer[1]->SetColor(0.6f, 0.7f, 1.0f);

	Scene.GetCamera()->SetTarget(Scene.primitiveContainer[0]);

	return Scene;
}

CScene Test()
{
	CScene Scene = CScene(640, 480, new CPinholeCamera(640, 480));

	return Scene;
}

#endif /* _SCENES_H */